﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;


namespace ATM
{
     
    public partial class withdraw : Form
    {
       // AccountDB d = new AccountDB();
        AccountLogic ca = new AccountLogic();
        public string accountnum, accou, t;
      //float num, num2, result;
        public withdraw(string accnum)
        {
            InitializeComponent();
            accountnum = accnum;
        }
    

        private void Withdraw_Balance_Click_1(object sender, EventArgs e)// with draw
        {
            t = textBox1.Text;
            accou = accountnum;
            ca.wdrcall(t, accou);
            if (ca.ch == 1)
            {
                if (ca.checkforBAL == 1)
                {
                    if (ca.lessBalan == 1)
                    {
                        this.Hide();
                        inter_face frm = new inter_face(accou);
                        frm.Show();
                    }
                    else
                    {
                        MessageBox.Show("not enough balance for utilisation sir !!");
                    }
                }
                else
                {
                    MessageBox.Show("The balance can not be less than 10 or more than 5000");
                    textBox1.Clear();
                }
            }
            else
            {
                MessageBox.Show("It must be a positive Numeric value");
                textBox1.Clear();
            }

               

            
        }

    

       
        private void Numbers_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;
            textBox1.Text = textBox1.Text + b.Text;
        }

        private void Clear_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
        }

        private void exitButt_Click(object sender, EventArgs e)
        {
            welcom w = new welcom();
            w.Show();
            this.Hide();
        }

        private void backButt_Click(object sender, EventArgs e)
        {
            inter_face inter = new inter_face(accountnum);
            inter.Show();
            this.Hide();
        }

        
    }
}
